﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Skyworth.CRM.Service.Entity;
using Skyworth.CRM.Service.IBLL;
using Skyworth.CRM.Service.IDAL;

namespace Skyworth.CRM.BLL
{
   public class OrdersBLL:IOrdersBLL
    {
        private IOrdersDAL _orderDAL;

        public OrdersBLL(IOrdersDAL ordersDAL)
        {
            _orderDAL = ordersDAL;
        }

        public string AddOrder(Order model, DataTable orderDetail, Boolean isSubmit)
       {
           return _orderDAL.AddOrder(model, orderDetail,isSubmit);
       }

       public Order GetOrderById(int orderId, out DataTable orderDetail)
       {
           return _orderDAL.GetOrderById(orderId, out orderDetail);
       }

       public bool UpdateOrder(Order model, DataTable orderDetail, Boolean isSubmit)
       {
           return _orderDAL.UpdateOrder(model, orderDetail,isSubmit);
       }

       public DataTable GetOrdersByPage(string strWhere, string strOrderBy, int pageIndex, int pageSize, out int recordCount, out int pageCount)
       {
           return _orderDAL.GetOrdersByPage(strWhere, strOrderBy, pageIndex, pageSize, out recordCount, out pageCount);
       }

       public void Delete(int orderId)
       {
           _orderDAL.Delete(orderId);
       }

       public DataTable GetOrderDetail(int orderId)
       {
           return _orderDAL.GetOrderDetail(orderId);
       }

       public void Submit(int orderId, int status)
       {
           _orderDAL.Submit(orderId, status);
       }

       public DataTable GetOrderProcess(int orderId)
       {
           return _orderDAL.GetOrderProcess(orderId);
       }

       public DataTable GetOrdersToDo(int empId)
       {
           return _orderDAL.GetOrdersToDo(empId);
       }

       public void HandleOrder(int empId, int orderId, int status, string notes, int bhStep)
       {
           _orderDAL.HandleOrder(empId,orderId,status,notes,bhStep);
       }
    }
}
